package com.wanxi.controller.front;

import com.alibaba.fastjson2.JSONObject;
import com.wanxi.dto.ResultDTO;
import com.wanxi.service.ContactService;
import com.wanxi.vo.ContactVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("contact")
@CrossOrigin(origins = "http://localhost:8081")
@RequestMapping("/contact")
public class ContactController {
    @Autowired
    ContactService contactService;

    @PostMapping("/add")
    public String addContact(ContactVO contactVO){
        ResultDTO resultDTO = contactService.addContact(contactVO);
        return JSONObject.toJSONString(resultDTO);
    }
}
